package com.spddr.pmos.jpa;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.joda.time.DateTime;

import cn.seqdata.jpa.AbstractPersistable;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

@Entity
@Table(name = "dispatch_order")
public class DispatchOrder extends AbstractPersistable<DispatchOrderId> {
	private static final long serialVersionUID = 1L;

	private DispOrderType type;
	private Double value;

	public DispatchOrder() {
	}

	public DispatchOrder(DateTime occur, int type, long psr) {
		setId(new DispatchOrderId(occur, type, psr));
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "type", nullable = false, insertable = false, updatable = false)
	@JsonSerialize(using = cn.seqdata.jackson.TypeSerializer.IdName.class)
	public DispOrderType getType() {
		return this.type;
	}

	public void setType(DispOrderType type) {
		this.type = type;
	}

	@Column(name = "value")
	public Double getValue() {
		return this.value;
	}

	public void setValue(Double value) {
		this.value = value;
	}
}